from django.contrib.auth import authenticate, login, logout

def AuthenticateUser(request, username, password):
    user = authenticate(username = username, password = password)
    if user is not None:
        if user.is_active:
            login(request, user)
            return (True, 'logged in')
        else:
            return (True, 'account disabled')
    else:
        return (False, '')


def LogoutUser(request):
    logout(request)
